#循环
#计算1+到100的值
i = 1
result = 0
while i <= 100:
    result += i
    i+=1
print(i,result)
#循环嵌套
i = 1
j = 1
while i<=3:
    print("第%d次外循环"%i)
    while j<=3:
        print(f"第{j}次内循环")
        j+=1
    i+=1
    j=1
#for循环 for 临时变量(索引) in 可迭代对象(数组)
i = 0
strs = "abcdefg"
for i in strs :
    print(i)
#range() 计数函数 range(开始,结束,步长) 包前不包后
#只写一个数代表循环次数从0开始
i = 0
for i in range(1,10):
    print(i)
i = 0
for i in range(10):
    print(i)
#用for打印1加100的值
i = 0
result = 0
for i in range(1,101):
    result += i
print(result)
#break continue 结束循环,跳过循环
